package org.yjhking.feignclient;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.yjhking.clientFallback.UserFeignClientFallbackFactory;
import org.yjhking.domain.User;

@FeignClient(value = "user-server", fallbackFactory = UserFeignClientFallbackFactory.class) // 指定需要调用的服务的应用名称
public interface UserFeignClient {
    
    /*
     * OpenFeign调用user服务接口，默认底层会帮助我们创建动态代理实现类，底层会使用RestTemplate进行调用
     **/
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);
    
}